package gamestate;

import java.awt.Graphics2D;
import java.util.Stack;

public class StateStack 
{
	private Stack<State> stack;
	
	public StateStack()
	{
		stack = new Stack<State>();
	}
	
	public void update(double duration)
	{
		stack.peek().update(duration);
	}
	public void render(Graphics2D g)
	{
		stack.peek().render(g);
	}
	
	public void push(State s)
	{
		stack.push(s);
	}
	
	public void pop()
	{
		stack.pop();
	}
	
	public State getTop()
	{
		return stack.peek();
	}
	
	public State get(int i)
	{
		return stack.get(stack.size()-1-i);
	}
}
